﻿using PitOfDespair;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace PitOfDespair.Tests
{


    /// <summary>
    ///This is a test class for CharacterTest and is intended
    ///to contain all CharacterTest Unit Tests
    ///</summary>
    [TestClass()]
    public class CharacterTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        Character_Accessor GenerateCharacter(byte level=0,int toHit = 0, int avoidance = 0, int maxHealth = 1, int currentHealth = 1)
        {
            return new Character_Accessor(level,toHit, avoidance, maxHealth, currentHealth,null,new Microsoft.Xna.Framework.Rectangle(1,1,1,1));
        }

        /// <summary>
        ///A test for Character Constructor
        ///</summary>
        [TestMethod()]
        [DeploymentItem("PitOfDespair.exe")]
        public void CharacterConstructorTest()
        {
            Character_Accessor target = GenerateCharacter();

        }

        /// <summary>
        ///A test for RollDamage
        ///</summary>
        [TestMethod()]
        [DeploymentItem("PitOfDespair.exe")]
        public void RollDamage_NotNegative()
        {
            var target = GenerateCharacter();
            int actual;
            actual = target.RollDamage();
            Assert.IsTrue(actual >= 0);
        }

        /// <summary>
        ///A test for Avoidance
        ///</summary>
        [TestMethod()]
        [DeploymentItem("PitOfDespair.exe")]
        public void AvoidanceTest()
        {
            int expected = 0;
            var target = GenerateCharacter(avoidance: expected);

            int actual = target.Avoidance;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Health
        ///</summary>
        [TestMethod()]
        [DeploymentItem("PitOfDespair.exe")]
        public void CurrentHealthTest()
        {
            int expected = 5;
            var target = GenerateCharacter(currentHealth: expected);

            int actual = target.Health;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for MaxHealth
        ///</summary>
        [TestMethod()]
        [DeploymentItem("PitOfDespair.exe")]
        public void MaxHealthTest()
        {
            int expected = 5;

            var target = GenerateCharacter(maxHealth: expected);

            int actual;

            actual = target.MaxHealth;
            Assert.AreEqual(expected, actual);

        }


        /// <summary>
        ///A test for ToHit
        ///</summary>
        [TestMethod()]
        [DeploymentItem("PitOfDespair.exe")]
        public void ToHitTest()
        {
            int expected = 6;
            var target = GenerateCharacter(toHit: expected);
            int actual;
            target.ToHit = expected;
            actual = target.ToHit;
            Assert.AreEqual(expected, actual);

        }
    }
}
